package com.obradovicnjegovan.webprodavnica.so.impl;

import java.util.List;

import org.apache.tapestry5.ioc.annotations.Inject;

import com.obradovicnjegovan.webprodavnica.dao.HibernateDao;
import com.obradovicnjegovan.webprodavnica.so.PronadjiSve;

public class PronadjiSveImpl<T> implements PronadjiSve<T>{
	@Inject
	private HibernateDao hibernateDao;
	private Class<T> klasa;
	public HibernateDao getHibernateDao() {
		return hibernateDao;
	}
	public void setHibernateDao(HibernateDao hibernateDao) {
		this.hibernateDao = hibernateDao;
	}
	public Class<T> getKlasa() {
		return klasa;
	}
	public void setKlasa(Class<T> klasa) {
		this.klasa = klasa;
	}
	public Object execute() {
		try {
			List<T> lista = hibernateDao.get(getKlasa());
			return lista;
		} catch (Exception e) {
			return null;
		}
	}
}
